<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
        <script src="js/jquery-3.6.3.min.js.txt"></script>
    <style>
        .hide{
            pointer-events: none;
            color: gray;
        }
    </style>
    <script>
        $(function () {
            $("#pager a").click(function () {
                if(window.confirm("你真的要换页？"))
                    return true;
                return false;
            });
        });
    </script>
</head>
<body>
<%@include file="/checkLogin.jsp"%>
<%--<div>
    <img src="imgs/2019.jpg"/>
</div>--%>
<div>
    <%--<%--%>
        <%----%>
<%--//        Page<Grade> p= (Page<Grade>) request.getAttribute("p");--%>
<%--//        int pageNo= p.getPageNo();--%>
    <%--%>--%>
    <a href="addSubject.jsp"> <input type="button" value="添加新年级"></a>
</div>

<table border="1" width="85%" cellspacing="0" cellpadding="0">
    <tr bgcolor="#d3d3d3">
        <th>编号</th>
        <th>年级名称</th>
        <th>操作</th>
    </tr>

   <c:forEach items="${p.data}" var="i" >
    <tr>
        <td>
            ${i.id}
        </td>
        <td>
                ${i.gname}
        </td>

        <td><a href="toUpdateGrade?id=${i.id}">编辑</a>
            &nbsp;&nbsp;
        <a onclick="return confirm('真的要删除这门课?')" href="delsubject.jsp?id=${i.id}">删除</a></td>
    </tr>
    </c:forEach>

</table>
<p id="pager">

    <a href="grade?pageNo=1">首页</a>
    <a  <c:if test="${p.pageNo<=1}">class='hide' </c:if> href="grade?pageNo=${p.pageNo-1}">上一页</a>
    <a  <c:if test="${p.pageNo>=p.pageTotal}"> class='hide' </c:if> href="grade?pageNo=${p.pageNo+1}" >下一页</a>
    <a href="grade?pageNo=${p.pageTotal}">尾页</a>
</p>
</body>
</html>